find_package(Qt${QT_VERSION_MAJOR} QUIET COMPONENTS Charts)
if(Qt${QT_VERSION_MAJOR}Charts_FOUND)
  add_compile_definitions(X_ENABLE_CHARTS)
  list(APPEND X_LIBS Qt${QT_VERSION_MAJOR}::Charts)
else()
  # If Qt Charts is not found, we need to remove the files that depend on it
  file(GLOB_RECURSE CHARTS_FILES "${CMAKE_SOURCE_DIR}/src/page/panels/outputpanels/charts/*.*")
  message(STATUS "[Charts]Remove Qt Charts files from X_SOURCES")
  foreach(file ${CHARTS_FILES})
    message(STATUS "[Charts]Remove file: ${file}")
    list(REMOVE_ITEM X_SOURCES "${file}")
  endforeach()
endif()
